/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package View;

import java.awt.GridLayout;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

/**
 *
 * @author Tom Gurung
 */
public class CustomBoard extends JFrame{
    
    private ArrayList<Integer> uppers;
    private ArrayList<Integer> downers;
    private JTextField rowsInput;
    private JTextField colsInput;
    private JTextField upper1;
    private JTextField upper2;
    private JTextField upper3;
    private JTextField upper4;
    private JTextField upper5;
    private JTextField upper6;
    private JTextField upper7;
    private JTextField upper8;
    private JTextField upper9;
    private JTextField upper10;
    private JTextField downer1;
    private JTextField downer2;
    private JTextField downer3;
    private JTextField downer4;
    private JTextField downer5;
    private JTextField downer6;
    private JTextField downer7;
    private JTextField downer8;
    private JTextField downer9;
    private JTextField downer10;
    private JButton saveUp = new JButton("Save Ups");
    private JButton saveDown = new JButton("Save Downs");
    private JButton create = new JButton("Create");
    
    /*public static void main(String args[]) {
        new CustomBoard();
    }*/
    
    
    public CustomBoard() {
        uppers = new ArrayList(10);
        downers = new ArrayList(10);
        
        rowsInput = new JTextField(5);
        colsInput = new JTextField(5);
        upper1 = new JTextField(5);
        upper2 = new JTextField(5);
        upper3 = new JTextField(5);
        upper4 = new JTextField(5);
        upper5 = new JTextField(5);
        upper6 = new JTextField(5);
        upper7 = new JTextField(5);
        upper8 = new JTextField(5);
        upper9 = new JTextField(5);
        upper10 = new JTextField(5);
        downer1 = new JTextField(5);
        downer2 = new JTextField(5);
        downer3 = new JTextField(5);
        downer4 = new JTextField(5);
        downer5 = new JTextField(5);
        downer6 = new JTextField(5);
        downer7 = new JTextField(5);
        downer8 = new JTextField(5);
        downer9 = new JTextField(5);
        downer10 = new JTextField(5);
        
        
        JPanel panel = new JPanel();
        panel.setLayout(new GridLayout(17,3));
        
        panel.add(new JLabel("Row*Cols"));
        panel.add(rowsInput);
        panel.add(colsInput);
        panel.add(new JLabel(""));
        panel.add(new JLabel("Uppers"));
        panel.add(new JLabel(""));
        panel.add(new JLabel("First"));
        panel.add(upper1);
        panel.add(upper2);
        panel.add(new JLabel("Second"));
        panel.add(upper3);
        panel.add(upper4);
        panel.add(new JLabel("Third"));
        panel.add(upper5);
        panel.add(upper6);
        panel.add(new JLabel("Fourth"));
        panel.add(upper7);
        panel.add(upper8);
        panel.add(new JLabel("Fifth"));
        panel.add(upper9);
        panel.add(upper10);
        panel.add(new JLabel(""));
        panel.add(new JLabel(""));
        panel.add(saveUp);
        panel.add(new JLabel(""));
        panel.add(new JLabel("Downers"));
        panel.add(new JLabel(""));
        panel.add(new JLabel("First"));
        panel.add(downer1);
        panel.add(downer2);
        panel.add(new JLabel("Second"));
        panel.add(downer3);
        panel.add(downer4);
        panel.add(new JLabel("Third"));
        panel.add(downer5);
        panel.add(downer6);
        panel.add(new JLabel("Fourth"));
        panel.add(downer7);
        panel.add(downer8);
        panel.add(new JLabel("Fifth"));
        panel.add(downer9);
        panel.add(downer10);
        panel.add(new JLabel(""));
        panel.add(new JLabel(""));
        panel.add(saveDown);
        panel.add(new JLabel(""));
        panel.add(new JLabel(""));
        panel.add(create);
        this.add(panel);
        this.pack();
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setSize(900,727);
        this.setResizable(false);
        //this.setVisible(true);
                
    }
    
    public int getRows() {
        String temp = rowsInput.getText();
        int rows = Integer.parseInt(temp);
        return rows;
            
    }
    
    public int getColums() {
        String temp2 = colsInput.getText();
        int cols = Integer.parseInt(temp2);
        return cols;
    }
    
    public ArrayList getUppers() {
            String temp = upper1.getText();
            int value = Integer.parseInt(temp);
            uppers.add(value);
            String temp2 = upper2.getText();
            int value2 = Integer.parseInt(temp2);
            uppers.add(value2);
            String temp3 = upper3.getText();
            int value3 = Integer.parseInt(temp3);
            uppers.add(value3);
            String temp4 = upper4.getText();
            int value4 = Integer.parseInt(temp4);
            uppers.add(value4);
            String temp5 = upper5.getText();
            int value5 = Integer.parseInt(temp5);
            uppers.add(value5);
            String temp6 = upper6.getText();
            int value6 = Integer.parseInt(temp6);
            uppers.add(value6);
            String temp7 = upper7.getText();
            int value7 = Integer.parseInt(temp7);
            uppers.add(value7);
            String temp8 = upper8.getText();
            int value8 = Integer.parseInt(temp8);
            uppers.add(value8);
            String temp9 = upper9.getText();
            int value9 = Integer.parseInt(temp9);
            uppers.add(value9);
            String temp10 = upper10.getText();
            int value10 = Integer.parseInt(temp10);
            uppers.add(value10);
            return uppers;
        
    }
    
    public ArrayList getDowns() {
        String temp = downer1.getText();
            int value = Integer.parseInt(temp);
            downers.add(value);
            String temp2 = downer2.getText();
            int value2 = Integer.parseInt(temp2);
            downers.add(value2);
            String temp3 = downer3.getText();
            int value3 = Integer.parseInt(temp3);
            downers.add(value3);
            String temp4 = downer4.getText();
            int value4 = Integer.parseInt(temp4);
            downers.add(value4);
            String temp5 = downer5.getText();
            int value5 = Integer.parseInt(temp5);
            downers.add(value5);
            String temp6 = downer6.getText();
            int value6 = Integer.parseInt(temp6);
            downers.add(value6);
            String temp7 = downer7.getText();
            int value7 = Integer.parseInt(temp7);
            downers.add(value7);
            String temp8 = downer8.getText();
            int value8 = Integer.parseInt(temp8);
            downers.add(value8);
            String temp9 = downer9.getText();
            int value9 = Integer.parseInt(temp9);
            downers.add(value9);
            String temp10 = downer10.getText();
            int value10 = Integer.parseInt(temp10);
            downers.add(value10);     
            return downers;
    }
    
    public void addActionListener(ActionListener mal) {
        saveUp.addActionListener(mal);
        saveDown.addActionListener(mal);
        create.addActionListener(mal);
    }
    
}
